<template>
  <div>
    <h1>Parent</h1>
    <Child ref="child"/>
    <button @click="updateChild">修改子组件数据</button>
  </div>
</template>

<script>
import Child from './Child.vue'
export default {
    name:'Parent',
    components:{
        Child
    },
    methods: {
      updateChild(){
        this.$refs.child.num+=3
      }
    },
}
</script>

<style>

</style>